package zoro.shopping_list;

import java.util.ArrayList;

import android.os.Bundle;
import android.os.SystemClock;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class MainActivity extends Activity {

	ListView lvShoplist;
	ShopListAdapter shopAdapter;
	ArrayList<Shoplist> shoplist;
	
	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	
	lvShoplist  = (ListView) findViewById(R.id.lv_list);
	shoplist    = ShoplistModel.getShopList();
	shopAdapter = new ShopListAdapter(this, R.layout.row_list, shoplist);
	
	lvShoplist.setAdapter(shopAdapter);
	lvShoplist.setOnItemClickListener(new OnItemClickListener() {

		@Override
		public void onItemClick(AdapterView<?> arg0, View view, int pos,
				long id) {
			Toast.makeText(MainActivity.this, "id: "+ pos, Toast.LENGTH_LONG).show();
		}
	});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
